feat(deno): add express integration#22461
Conversation
6d5b8ae to
6237ccf
Compare
5da649b to
ad82a2a
Compare
6237ccf to
4c157ad
Compare
ad82a2a to
ba29b3a
Compare
4c157ad to
86ed574
Compare
ba29b3a to
a2c00be
Compare
86ed574 to
55f7640
Compare
a2c00be to
e758510
Compare
| import { assertEquals } from 'https://deno.land/std@0.212.0/assert/assert_equals.ts'; | ||
| import { assertExists } from 'https://deno.land/std@0.212.0/assert/assert_exists.ts'; | ||
|
|
||
| function resetGlobals(): void { |
There was a problem hiding this comment.
l: are these helpers the same in all tests? if yes maybe worth extracting out
55f7640 to
8d4883f
Compare
a100fe7 to
9d37f38
Compare
8d4883f to
5b72b0b
Compare
size-limit report 📦
|
5b72b0b to
9f9dca3
Compare
9d37f38 to
cee6ad4
Compare
9f9dca3 to
b2b7f0f
Compare
14acde5 to
1414310
Compare
b2b7f0f to
632cfe9
Compare
632cfe9 to
d79eaf2
Compare
1414310 to
62951af
Compare
| Deno.test('express instrumentation: orchestrion:express:handle channel produces a nested middleware span', async () => { | ||
| resetGlobals(); | ||
| const sink = transactionSink(); | ||
| init({ | ||
| dsn: 'https://username@domain/123', | ||
| tracesSampleRate: 1, | ||
| beforeSendTransaction: sink.beforeSendTransaction, | ||
| }); | ||
|
|
||
| const channel = tracingChannel('orchestrion:express:handle'); |
There was a problem hiding this comment.
Bug: The test suite does not reset the global installedIntegrations array between tests, causing test isolation failures where integrations are not re-initialized correctly.
Severity: LOW
Suggested Fix
In the test setup file, add installedIntegrations.splice(0, installedIntegrations.length) to the test's beforeEach or equivalent setup function. This will clear the array and ensure each test runs with a clean slate, matching the pattern used in other integration tests.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: dev-packages/deno-integration-tests/suites/orchestrion-express/test.ts#L65-L74
Potential issue: A test isolation issue exists where global state is not properly reset
between test runs. Specifically, the `installedIntegrations` global array is not
cleared. This prevents Sentry integrations, such as the Express integration, from being
set up again in subsequent tests because their `setupOnce()` method is skipped. This can
lead to fragile tests that implicitly rely on state from previous tests, rather than
running in a clean, isolated environment. While a module-level `_isInstrumented` flag
also prevents re-instrumentation, the primary issue is the lack of global state reset in
the test suite's setup.
No description provided.